/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * HAPSIEEditaArea.java
 *
 * Created on 24/01/2012, 06:27:52 PM
 */
package Interfaz;

import javax.swing.JOptionPane;

/**
 *
 * @author erika
 */
public class EditaArea extends javax.swing.JDialog {

    /** Creates new form HAPSIEEditaArea */
    public EditaArea(java.awt.Dialog parent) {
        super(parent);
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        textEditaArea = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        textEditaNombre = new javax.swing.JTextField();
        botonAceptaEditar = new javax.swing.JButton();
        botonCancelaEditar = new javax.swing.JButton();
        botoSalir = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(UsoHAPSIE.HAPSIEApp.class).getContext().getResourceMap(EditaArea.class);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        textEditaArea.setText(resourceMap.getString("textEditaArea.text")); // NOI18N
        textEditaArea.setName("textEditaArea"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        textEditaNombre.setText(resourceMap.getString("textEditaNombre.text")); // NOI18N
        textEditaNombre.setName("textEditaNombre"); // NOI18N
        textEditaNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textEditaNombreActionPerformed(evt);
            }
        });

        botonAceptaEditar.setText(resourceMap.getString("botonAceptaEditar.text")); // NOI18N
        botonAceptaEditar.setName("botonAceptaEditar"); // NOI18N
        botonAceptaEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonAceptaEditarActionPerformed(evt);
            }
        });

        botonCancelaEditar.setText(resourceMap.getString("botonCancelaEditar.text")); // NOI18N
        botonCancelaEditar.setName("botonCancelaEditar"); // NOI18N
        botonCancelaEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCancelaEditarActionPerformed(evt);
            }
        });

        botoSalir.setText(resourceMap.getString("botoSalir.text")); // NOI18N
        botoSalir.setName("botoSalir"); // NOI18N
        botoSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botoSalirActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(botonAceptaEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(58, 58, 58)
                        .addComponent(botonCancelaEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(128, 128, 128)
                        .addComponent(botoSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textEditaArea, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(textEditaNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 341, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(208, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(textEditaArea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35)
                .addComponent(jLabel2)
                .addGap(18, 18, 18)
                .addComponent(textEditaNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonAceptaEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonCancelaEditar, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)
                    .addComponent(botoSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void botonCancelaEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCancelaEditarActionPerformed
int response = JOptionPane.showConfirmDialog(this, "Deseas Guardar todos los cambios", "AVISO!!", JOptionPane.WARNING_MESSAGE);

   if (response == JOptionPane.NO_OPTION) {
       this.setVisible(false);       
       getOwner().setVisible(true);
    } else if (response == JOptionPane.YES_OPTION) {
       this.setVisible(false);
   //
   // Aqui guardamos todo los cambios
   //Todos 
       getOwner().setVisible(true);
   
   
    } else if (response == JOptionPane.CLOSED_OPTION) {
      
        
    }

}//GEN-LAST:event_botonCancelaEditarActionPerformed

private void botonAceptaEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAceptaEditarActionPerformed
 JOptionPane.showMessageDialog(this, "Todos los cambios han sido guardados");
}//GEN-LAST:event_botonAceptaEditarActionPerformed

private void textEditaNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textEditaNombreActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_textEditaNombreActionPerformed

private void botoSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botoSalirActionPerformed
int response = JOptionPane.showConfirmDialog(this, "Deseas Guardar todos los cambios", "AVISO!!", JOptionPane.WARNING_MESSAGE);

   if (response == JOptionPane.NO_OPTION) {
       this.setVisible(false);       
       getOwner().setVisible(true);
    } else if (response == JOptionPane.YES_OPTION) {
       this.setVisible(false);
   //
   // Aqui guardamos todo los cambios
   //Todos 
       getOwner().setVisible(true);
   
   
    } else if (response == JOptionPane.CLOSED_OPTION) {
      
        
    }

}//GEN-LAST:event_botoSalirActionPerformed

private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
int response = JOptionPane.showConfirmDialog(this, "Deseas Guardar todos los cambios", "AVISO!!", JOptionPane.WARNING_MESSAGE);

   if (response == JOptionPane.NO_OPTION) {
       this.setVisible(false);       
       getOwner().setVisible(true);
    } else if (response == JOptionPane.YES_OPTION) {
       this.setVisible(false);
   //
   // Aqui guardamos todo los cambios
   //Todos 
   getOwner().setVisible(true); 
    } else if (response == JOptionPane.CLOSED_OPTION) {
      
        
    }

}//GEN-LAST:event_formWindowClosing

    /**
     * @param args the command line arguments
     */
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botoSalir;
    private javax.swing.JButton botonAceptaEditar;
    private javax.swing.JButton botonCancelaEditar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JTextField textEditaArea;
    private javax.swing.JTextField textEditaNombre;
    // End of variables declaration//GEN-END:variables
}
